package com.lecyon.farm.vo.view;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.lecyon.farm.common.constant.CommonConstant;
import com.lecyon.farm.common.constant.FarmSysConstant;
import com.lecyon.farm.util.StringHelper;
import com.lecyon.farm.vo.base.BaseViewVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDate;

/**
 * @author YaoZheng
 * @since 2020-04-02
 */
@Data
@ApiModel("农机作业统计Vo")
public class FmStatisticDataVo extends BaseViewVo {

    @ApiModelProperty(name = "carId", value = "农机号")
    private String carId;

    @ApiModelProperty(name = "carOwner", value = "车主")
    private String carOwner;

    @ApiModelProperty(name = "carOwnerPhone", value = "电话")
    private String carOwnerPhone;

    @ApiModelProperty(name = "type", value = "耕种类型")
    private String type;

    @ApiModelProperty(name = "type_dict", value = "耕种类型Dict")
    private String typeDict;

    @ApiModelProperty(name = "depth", value = "深度")
    private String depth;

    @ApiModelProperty(name = "passRate", value = "合格率")
    private String passRate;

    @ApiModelProperty(name = "workLandarea", value = "作业面积")
    private String workLandarea;

    @ApiModelProperty(name = "submitLandarea", value = "提交面积")
    private String submitLandarea;

    @ApiModelProperty(name = "qualifiedLandarea", value = "合格面积")
    private String qualifiedLandarea;

    @ApiModelProperty(name = "distance", value = "里程")
    private String distance;

    @ApiModelProperty(name = "overlapRate", value = "重叠率")
    private String overlapRate;

    @ApiModelProperty(name = "repeatRate", value = "重耕率")
    private String repeatRate;

    @ApiModelProperty(name = "missRate", value = "漏耕率")
    private String missRate;

    @ApiModelProperty(name = "beginDate", value = "开始日期")
    @JsonFormat(pattern = CommonConstant.DATE_FORMAT_PATTERN, timezone = CommonConstant.TIME_ZONE)
    private LocalDate beginDate;

    @ApiModelProperty(name = "endDate", value = "结束日期")
    @JsonFormat(pattern = CommonConstant.DATE_FORMAT_PATTERN, timezone = CommonConstant.TIME_ZONE)
    private LocalDate endDate;

    @ApiModelProperty(name = "totalFlow", value = "植保流量")
    private String totalFlow;

    @ApiModelProperty(name = "seed", value = "播种数")
    private String seed;

    @ApiModelProperty(name = "seed_per_mu", value = "播种数/亩")
    private String seedPerMu;

    private String userCode;

    public String getTypeDict() {
        if (StringHelper.isNotEmpty(type)) {
            boolean flag = FarmSysConstant.SYS_JOB_TYPE_MAP.containsKey(type);
            if (flag) {
                typeDict = FarmSysConstant.SYS_JOB_TYPE_MAP.get(type);
                if (StringHelper.isNotEmpty(typeDict)) {
                    return typeDict;
                }
            }
        }
        return typeDict;
    }
}
